package hotel.entity;

import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.OneToOne;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

@Entity
@Table
public class Sales {

	@Id
	@GeneratedValue(strategy=GenerationType.AUTO)
	private int salesid;
	
	@Column(nullable=false)
	private String orderNumber;//订单号
	
	@JoinColumn
	@OneToOne(fetch=FetchType.EAGER)
	private User operateUser;//操作员编号
	
	@JoinColumn
	@OneToOne(fetch=FetchType.EAGER)
	private Category category;//房型
	
	@Column(nullable=false)
	private int amount;//房间数量
	
	private double totalPrice;//总价
	
	@Temporal(TemporalType.TIMESTAMP)
	private Date salesTime;//销售时间
	
	@JoinColumn
	@OneToOne(fetch=FetchType.EAGER)
	private Reserve reserve;//对应的预定，没有预定则为空
	

	public int getSalesid() {
		return salesid;
	}

	public void setSalesid(int salesid) {
		this.salesid = salesid;
	}

	public String getOrderNumber() {
		return orderNumber;
	}

	public void setOrderNumber(String orderNumber) {
		this.orderNumber = orderNumber;
	}

	public User getOperateUser() {
		return operateUser;
	}

	public void setOperateUser(User operateUser) {
		this.operateUser = operateUser;
	}

	public Category getCategory() {
		return category;
	}

	public void setCategory(Category category) {
		this.category = category;
	}

	public int getAmount() {
		return amount;
	}

	public void setAmount(int amount) {
		this.amount = amount;
	}

	public double getTotalPrice() {
		return totalPrice;
	}

	public void setTotalPrice(double totalPrice) {
		this.totalPrice = totalPrice;
	}

	public Date getSalesTime() {
		return salesTime;
	}

	public void setSalesTime(Date salesTime) {
		this.salesTime = salesTime;
	}

	public Reserve getReserve() {
		return reserve;
	}

	public void setReserve(Reserve reserve) {
		this.reserve = reserve;
	}

}
